<div class="content-section implementation GridDemo" id="myContent" >
    <div class="title col-sm-12">
        <div class="col-sm-1">
            <span>{{formTitle}}</span>
        </div>
        <div class="col-sm-11 pull-right">
            <button type="button"
                    class="pull-right"
                    pButton
                    (click)="goBack()"
                    icon="fa-close"
                    style="width: 30px"></button>
        </div>
    </div>
    <form [formGroup]="myForm" class="form-horizontal">
        <div class="form-group">
            <label class="col-sm-2 control-label">下架单号：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <input type="text" pInputText
                       class="form-control cursor_not_allowed"
                       placeholder="自动生成"
                       readonly
                       [value]="formObj.sid"
                />
            </div>
            <label class="col-sm-2 control-label">状态：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <input type="text"
                       class=" form-control cursor_not_allowed"
                       pInputText
                       placeholder="自动生成"
                       [value]="formObj.status"
                       readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>
                申请人：</label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <div class="col-sm-6 ui-fluid ui-fluid-no-padding">
                    <input type="text" pInputText
                           readonly
                           formControlName="applicant"
                           [(ngModel)]="formObj.applicant"
                           class=" form-control cursor_not_allowed"/>
                    <app-field-error-display [displayError]="isFieldValid('applicant')" errorMsg="不能为空"></app-field-error-display>
                </div>
                <div class="col-sm-3 ui-fluid-no-padding ui-padding-10px">
                    <button  ngClass="ui-g-12 ui-fluid-no-padding"  pButton type="button" (click)="showPersonDialog()" label="选择"></button>
                </div>
                <div class="col-sm-3 ui-fluid-no-padding ui-padding-10px">
                    <button  ngClass="ui-g-12 ui-fluid-no-padding"  pButton type="button" (click)="clearPersonDialog()" label="清空"></button>
                </div>
            </div>
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>
                申请人组织：</label>
            <div class="col-sm-4 ui-fluid-no-padding">
                <input type="text"
                       class=" form-control cursor_not_allowed"
                       pInputText
                       placeholder="自动生成"
                       formControlName="applicant_org"
                       [(ngModel)]="formObj.applicant_org"
                       readonly />
                <app-field-error-display [displayError]="isFieldValid('applicant_org')" errorMsg="不能为空"></app-field-error-display>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>
                下架类型：
            </label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-dropdown [options]="allTypes"
                            [(ngModel)]="formObj.unshelve_type"
                            [ngModelOptions]="{standalone: true}"
                            [style]="{'width':'100%'}"
                ></p-dropdown>
            </div>
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>
                审批人：
            </label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-dropdown [options]="approval"
                            [(ngModel)]="formObj.approve"
                            [ngModelOptions]="{standalone: true}"
                            [style]="{'width':'100%'}"
                ></p-dropdown>
            </div>
        </div>
        <div class="form-group" formGroupName="timeGroup">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>
                计划下架时间：
            </label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-calendar [(ngModel)]="formObj.plantime_begin"
                            [showIcon]="true"
                            [locale]="zh"
                            [styleClass]="'schedule-add'"
                            dateFormat="yy-mm-dd"
                            [showTime]="true"
                            formControlName="plan_time_begin"
                            [showSeconds]="true">
                </p-calendar>
                <app-field-error-display [displayError]="isFieldGroupItemValid('plan_time_begin')" errorMsg="不能为空"></app-field-error-display>
                <app-field-error-display [displayError]="isFieldFroupValid() && myForm.get('timeGroup').get('plan_time_begin').touched" errorMsg="开始时间不能与结束时间相同"></app-field-error-display>
            </div>
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>
                计划完成时间：
            </label>
            <div class="col-sm-4 ui-fluid-no-padding ui-fluid">
                <p-calendar [(ngModel)]="formObj.plantime_end"
                            [showIcon]="true"
                            [locale]="zh"
                            [styleClass]="'schedule-add'"
                            dateFormat="yy-mm-dd"
                            [showTime]="true"
                            formControlName="plan_time_end"
                            [showSeconds]="true">
                </p-calendar>
                <app-field-error-display [displayError]="isFieldGroupItemValid('plan_time_begin')" errorMsg="不能为空"></app-field-error-display>
                <app-field-error-display [displayError]="isFieldFroupValid() && myForm.get('timeGroup').get('plan_time_begin').touched" errorMsg="开始时间不能与结束时间相同"></app-field-error-display>
            </div>
        </div>
        <div class="form-group ">
            <label class="col-sm-2 control-label">
                <span ngClass="start_red">*</span>
               下架原因：</label>
            <div class="col-sm-10 ui-no-padding-left-15px ui-fluid">
                  <textarea [rows]="5" pInputTextarea
                            [(ngModel)]="formObj.unshelve_reason"
                            formControlName="unshelve_reason"
                            autoResize="autoResize"></textarea>
              <app-field-error-display [displayError]="isFieldValid('unshelve_reason')" errorMsg="不能为空"></app-field-error-display>

              <!--<div class="ui-message ui-messages-error ui-corner-all" *ngIf="title">-->
                    <!--<i class="fa fa-close"></i>-->
                    <!--不能为空-->
                <!--</div>-->
            </div>
        </div>
        <div class="form-group ">
            <div class="col-sm-12 ui-no-padding-left-15px ">
                <button class="pull-right" pButton type="button"  label="选择下架设备" (click)="openEquipList()"></button>
                <button class="pull-right" pButton type="button"   label="移除设备" (click)="removeEquipmenst()"  ></button>
            </div>
        </div>
        <div class="form-group ">
            <div class="col-sm-12 padding-left-2vw">
                <app-basic-selected-table #basicSelectedTable (tableDataEmitter)="tableDataEmitter($event)"></app-basic-selected-table>
            </div>
        </div>
        <div class="form-group ">
            <div class="col-sm-12 ui-no-padding-left-15px ">
                <button class="pull-right ui-margin-right-10px" pButton type="button" (click)="submit()" label="提交" ></button>
                <button  class="pull-right ui-margin-right-10px" pButton type="button" (click)="save()" label="保存" ></button>
            </div>
        </div>
        <!--<app-select-equipment [display]="controlDiaglog" (displayEmitter)="dcontrolDialogHandler($event)"></app-select-equipment>-->
    </form>
    <app-personel-dialog *ngIf="displayPersonel"
                         (dataEmitter)="dataEmitter($event)"
                         (displayEmitter)="displayEmitter($event)"></app-personel-dialog>
    <app-select-equipments #selectEquipments   (selectedEmitter)="selectedEquipsEmitter($event)" [display]="controlDiaglog" (displayEmitter)="dcontrolDialogHandler($event)" ></app-select-equipments>
</div>
